package com.neusoft.oa.controller.Email;

import com.neusoft.oa.pojo.Email;
import com.neusoft.oa.service.IInboxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/inbox")
@CrossOrigin
public class InboxController {

    @Autowired
    IInboxService inboxService;

    @RequestMapping("list")
    public List<com.neusoft.oa.pojo.Email> list(Email email){
        return inboxService.inboxList(email);

    }

    @RequestMapping("signlist")
    public List<com.neusoft.oa.pojo.Email> signlist(Email email){
        return inboxService.signList(email);
    }

    @RequestMapping("deletelist")
    public List<com.neusoft.oa.pojo.Email> deleteList(Email email){
        return inboxService.deleteList(email);
    }

    @RequestMapping("delete")
    public boolean delete(int emailid){
        return inboxService.inboxDelete(emailid);
    }

    @RequestMapping("deletes")
    public boolean deletes(int []emails){
        return inboxService.emailsDelete(emails);
//        for(int n:emails){
//            System.out.println(n);
//        }
//        return true;
    }

    @RequestMapping("sign")
    public boolean sign(int emailid){
        return inboxService.inboxSign(emailid);
    }

    @RequestMapping("cancelsign")
    public boolean cancelsign(int emailid){
        return inboxService.cancelSign(emailid);
    }

    @RequestMapping("canceldelete")
    public boolean canceldelete(int emailid){
        return inboxService.cancelDelete(emailid);
    }

}
